/**************************************************************************************
*
*	Copyright (C) 2009 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	ComponentModelRenderer.cpp
*
*	Comments	-	See ComponentModelRenderer.h
*
**************************************************************************************/
#include "../Include/ComponentCreators.h"
#include "../Include/FactoryComponent.h"
#include "../Include/ComponentCamera.h"
#include "../Include/ComponentModelFilter.h"
#include "../Include/ComponentModelRenderer.h"
#include "../Include/ComponentLight.h"
#include "../Include/ComponentTransform.h"
#include "../Include/ComponentReflection.h"
#include "../Include/ComponentNativeScript.h"
#include "../Include/ComponentPhysics.h"

namespace Pulse
{
	IComponent * ComponentCreateCamera( Actor *pOwner )
	{
		return new ComponentCamera( pOwner );
	}

	IComponent * ComponentCreateModelFilter( Actor *pOwner )
	{
		return new ComponentModelFilter( pOwner );
	}

	IComponent * ComponentCreateModelRenderer( Actor *pOwner )
	{
		return new ComponentModelRenderer( pOwner );
	}

	IComponent * ComponentCreateLight( Actor *pOwner )
	{
		return new ComponentLight( pOwner );
	}

	IComponent * ComponentCreateTransform( Actor *pOwner )
	{
		return new ComponentTransform( pOwner );
	}

	IComponent * ComponentCreateReflection( Actor *pOwner )
	{
		return new ComponentReflection( pOwner );
	}

	IComponent * ComponentCreateNativeScript( Actor *pOwner )
	{
		return new ComponentNativeScript( pOwner );
	}

	IComponent * ComponentCreatePhysics( Actor *pOwner )
	{
		return new ComponentPhysics( pOwner );
	}

	void RegisterComponentCreateMethods( void )
	{
		FactoryComponent *pFactory = FactoryComponent::GetInstance();

		pFactory->RegisterCreator( EComponent::TRANSFORM, ComponentCreateTransform );
		pFactory->RegisterCreator( EComponent::CAMERA, ComponentCreateCamera );
		pFactory->RegisterCreator( EComponent::LIGHT, ComponentCreateLight );
		pFactory->RegisterCreator( EComponent::MODEL_FILTER, ComponentCreateModelFilter );
		pFactory->RegisterCreator( EComponent::RENDERER, ComponentCreateModelRenderer );
		pFactory->RegisterCreator( EComponent::REFLECTION, ComponentCreateReflection );
		pFactory->RegisterCreator( EComponent::PHYSICS, ComponentCreatePhysics );
		pFactory->RegisterCreator( EComponent::NATIVE_SCRIPT, ComponentCreateNativeScript );
	}

	void UnregisterComponentCreateMethods( void )
	{
		FactoryComponent *pFactory = FactoryComponent::GetInstance();

		pFactory->ClearCreators();
	}
}